package com.boot.bloomFilter.controller;

import cn.hutool.bloomfilter.BloomFilterUtil;
import com.boot.bloomFilter.config.BloomFilterConfig;
import org.redisson.api.RBloomFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Author: lkz
 * @Title: TestController
 * @Description: TODO
 * @Date: 2023/9/15 17:21
 */
@RestController
public class TestController {


    @Autowired
    RedisTemplate redisTemplate;
    @Autowired
    BloomFilterConfig bloomFilterConfig;

    @GetMapping("add")
    public void add(){
        RBloomFilter<Object> bloomFilter = bloomFilterConfig.create("ids", 10000L, 0.01);
        redisTemplate.opsForValue().set("kk",23);
        bloomFilter.add("kk");
        if(bloomFilter.contains("kk")){

            System.out.println(redisTemplate.opsForValue().get("kk"));
        }
    }

}
